package com.woniu.dao;

import com.woniu.entity.Vedio;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.data.domain.Pageable;
import java.util.List;

/**
 * (Vedio)表数据库访问层
 *
 * @author makejava
 * @since 2025-06-10 11:59:04
 */
public interface VedioDao {

//    通过课程id获取对应课程下的视频信息列表
    @Select("select * from vedio where course_id=#{courseId}")
    List<Vedio> getVedioList(Integer courseId);
    //通过id查询课程信息
    @Select("select * from vedio where id = #{id}")
    Vedio selVedioById(Integer id);

    //修改视频信息
    @Update("update vedio set course_id = #{vedio.courseId},title = #{vedio.title}," +
            "url = #{vedio.url},file_size = #{vedio.fileSize},duration = #{vedio.duration}," +
            "sort = #{vedio.sort},content = #{vedio.content},update_time = NOW(),test = #{vedio.test}, " +
            "updater = #{vedio.updater} where id = #{id}")
    void updVedio(@Param("vedio") Vedio vedio);

    @Update("update vedio set test = #{examData} where id = #{videoId}")
    void saveExamToVideo(@Param("videoId") Integer videoId, @Param("examData") String examData);
}

